using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_Log : Admin, IRequiresSessionState
{
	protected GridView GridView1;
	protected Label PagePanel;
	protected Button Button1;
	protected TextBox Days;
	protected Button Button2;
	private string wherestr = "";
	private string orderstr = "";
	private string linkhead = "";
	private ArrayList al = new ArrayList();
	private IDbDataParameter[] param = null;
	private Pagination _pagehander;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected Pagination m_pagehander
	{
		get
		{
			Pagination pagehander;
			if (this._pagehander == null)
			{
				this._pagehander = new Pagination();
				this._pagehander.P_Object = "记录";
				pagehander = this._pagehander;
			}
			else
			{
				pagehander = this._pagehander;
			}
			return pagehander;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckSuperAdmin())
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "AdminLog");
			base.WriteRightErrMsg();
		}
		if (!base.IsPostBack)
		{
			this.BindList();
		}
	}
	protected void BindList()
	{
		this.QruestString();
		int num = Fetch.GetID("page");
		if (num == 0)
		{
			num = 1;
		}
		int pageSize = this.GridView1.PageSize;
		if (this.al.Count > 0)
		{
			this.param = new IDbDataParameter[this.al.Count];
			this.al.CopyTo(this.param, 0);
		}
		if (this.param != null)
		{
			this.GridView1.DataSource = this.m_pagehander.GetDataTable("HL_Log", num, pageSize, "LogID", this.wherestr, this.orderstr, this.conn, this.param);
		}
		else
		{
			this.GridView1.DataSource = this.m_pagehander.GetDataTable("HL_Log", num, pageSize, "LogID", this.wherestr, this.orderstr, this.conn, null);
		}
		this.GridView1.DataBind();
		this.m_pagehander.P_LinkHead = this.linkhead;
		this.PagePanel.Text = this.m_pagehander.ShowPagePanel();
	}
	protected void QruestString()
	{
	}
	protected void DeleteLog(object sender, CommandEventArgs e)
	{
		int iD = Convert.ToInt32(e.CommandArgument);
		LogBll logBll = new LogBll(this.conn);
		logBll.DeleteLog(iD);
		this.BindList();
	}
	protected void DeleteAllLog(object sender, EventArgs e)
	{
		string iDs = Text.CheckNumList(Fetch.GetOrPost("IDs"));
		LogBll logBll = new LogBll(this.conn);
		logBll.DeleteLog(iDs);
		this.BindList();
	}
	protected void DeleteLogByDate(object sender, CommandEventArgs e)
	{
		if (this.Days.Text != "")
		{
			if (Text.IsNumber(this.Days.Text))
			{
				DateTime time = DateTime.Now.AddDays((double)Convert.ToInt32("-" + this.Days.Text));
				LogBll logBll = new LogBll(this.conn);
				logBll.DeleteLogBf(time);
				this.BindList();
			}
		}
	}
	protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E7EDFE'");
		e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
	}
}
